package com.example.project_station;

import com.example.project_station.task.StationTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.io.IOException;

@SpringBootApplication
@EnableScheduling//开启定时任务功能
public class ProjectStationApplication implements CommandLineRunner {

    StationTask stationTask;


    public static void main(String[] args) throws IOException {

        SpringApplication.run(ProjectStationApplication.class, args);
    }

    @Autowired
    public ProjectStationApplication(StationTask stationTask){
        this.stationTask=stationTask;
    }

    @Override
    public void run(String... args) throws Exception {
        Thread.sleep(5000);
        stationTask.stationScheduled();
    }
}
